package com.wkm.myapplication.vp

import android.app.Activity
import android.content.Context
import android.graphics.Color
import android.util.Log
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.wkm.myapplication.R


class RV(context: Context) : RecyclerView(context) {


}


class VH(view: View) : RecyclerView.ViewHolder(view) {

}

val colors = arrayOf(
    "#33ffcc",
    "#ff33cc",
    "#778899"
)

class RVAdapter(val activity: Activity, private val datas: List<Object>) : RecyclerView.Adapter<VH>() {
    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
        val v = activity.layoutInflater.inflate(R.layout.rv, null)
        return VH(v)
    }

    override fun onBindViewHolder(holder: VH, position: Int) {

        holder.itemView.setBackgroundColor(
            Color.parseColor(colors[position % (colors.size)])
        )
    }


    override fun getItemCount(): Int {
        return datas.size
    }

}